import {debounce, throttle} from "@/utils";

export default Vue=>{
    Vue.directive('optimize',{
        inserted(el,binding){
            console.log(el,binding)
            if(binding.arg==='throttle'){
                el.addEventListener('click',throttle(()=>{
                    console.log('optimize---throttle')
                },1000))
            }else{
                el.addEventListener('click',debounce(()=>{
                    console.log('optimize---debounce')
                },1000))
            }
        }
    })
}